package com.gao.web.service;

import com.gao.web.dao.HouseMapper;
import com.gao.web.pojo.House;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HouseService {
    @Autowired
    HouseMapper houseMapper;

    public int updateHouse(int id, String build_area, String inside_area, String house_type, String address, String house_type_diagram, String price, String purchase_date, String post_date) {
        House house = new House(id, build_area, inside_area, house_type, address, house_type_diagram, price, purchase_date, post_date);
        return houseMapper.updateHouse(house);
    }

    public List<House> housefindall() {
        return houseMapper.housefindAll();
    }

    public List<House> findHousename(String id, String house_type) {
        return houseMapper.findHousename(id, house_type);
    }

    public List<House> findHouse(String address, String house_type) {
        return houseMapper.findHouse(address, house_type);
    }

    public int delete(int id) {
        House house = houseMapper.selectById(id);
        return houseMapper.delete(house);
    }

    public int insertHouse(String house_type, String build_area, String inside_area, String address, String house_type_diagram, String price, String post_date) {
        House house = new House(house_type, build_area, inside_area, address, house_type_diagram, price, post_date);
        return houseMapper.insertHouse(house);
    }
}
